package gmusic.filter;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.List;

public class MusicFilter implements FileFilter {

	public boolean accept(File pathname) {

		List<String> extensions = new ArrayList<String>();
		extensions.add(".mp3");

		if (pathname.isDirectory()) {
			return true;
		} else {
			String name = pathname.getName();
			for (int i = 0; i < extensions.size(); i++) {
				if (name.toLowerCase().endsWith(
						(String) extensions.get(i).toLowerCase())) {
					return true;
				}
			}
		}
		return false;
	}
}
